package com.lkk.cg.action;

import com.lkk.cg.base.BaseAction;
import com.lkk.cg.domain.Article;
import com.lkk.cg.util.QueryHelper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * Created by lkk on 2014/12/18.
 */
@Controller
@Scope("prototype")
public class ArticleManageAction extends BaseAction<Article> {

    /**
     * 列表
     *
     * @return
     */
    public String list() {
        QueryHelper queryHelper = new QueryHelper(Article.class, "a");
        queryHelper.preparePageBean(articleService, getPageNum(), getPageSize());
        return "list";
    }

    /**
     * 删除
     *
     * @return
     */
    public String delete() {
        log.debug("delete article id=" + model.getId());
        articleService.delete(model.getId());
        addActionMessage("文章删除成功");
        return "toList";
    }

}
